package com.iot.sdk.init;

import com.iot.sdk.service.DriverMetadataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @Author 咕唧
 * @Date 2022/7/26 21:11
 * @Version 1.0
 */
@Component
//@EnableConfigurationProperties(DriverProperty.class)
public class DriverIniter implements ApplicationRunner {

    private DriverMetadataService driverMetadataService;

    @Autowired
    public void setDriverMetadataService(DriverMetadataService driverMetadataService) {
        this.driverMetadataService = driverMetadataService;
    }

    /**
     * 当我们的程序启动的时候会执行这个run方法,有点类似于 postconstruct或者contextrefreshevent
     * @param args
     * @throws Exception
     */
    @Override
    public void run(ApplicationArguments args) throws Exception {
        //初始化驱动元数据
        driverMetadataService.init();
    }
}
